﻿

function popitup3(url)
  {
	newwindow=window.open(url,'name','height=450,width=560,scrollbars=5');
	if (window.focus) {newwindow.focus()}
	return false;
  }
 
function password()
{
var txt=document.getElementById('ctl00_ContentPlaceHolder1_txtEmailId');
var fileName=txt.value;
if(fileName != "")
{
alert("test");
document.getElementById('ctl00_ContentPlaceHolder1_pnlmodalpopup1').style.visibility='none';
}
else
{
var modalPopupBehaviorCtrl = $find('pnlmodalpopup1');
modalPopupBehaviorCtrl.hide();
}
}

function showgroup()
{
document.getElementById('ctl00_ContentPlaceHolder1_pnlCGroup').style.display ='block';
//document.getElementById('ctl00_ContentPlaceHolder1_btnCreateGroup_ModalPopupExtender').style.display = 'block';
}

function confirm_delete()
{
  if (confirm("Are you certain you wish to delete this group?"))
  {
    return true;
  }
}

function textCounter1(field,cntfield,maxlimit) 
{
//document.getElementById('ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_TabContainer1_TabPanel2_inTextBox').value=document.getElementById('ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_TabContainer1_TabPanel2_txtGroupSMS').value;
var ccc = document.getElementById('ctl00_ContentPlaceHolder1_txtmessage');
var aa = ccc.value;
//var ddd = document.getElementById('ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_txtarea');
//ddd.value = aa;
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}

function keys()
{
//ctl00_ContentPlaceHolder1_lblgrpnm
var ccc = document.getElementById('ctl00_ContentPlaceHolder1_txtGroup');
var aa = ccc.value;
var ddd = document.getElementById('ctl00_ContentPlaceHolder1_txtarea');
var dddd = document.getElementById('ctl00_ContentPlaceHolder1_txtarea1');
ddd.value = aa;
dddd.value = aa;
}
function textCounter2(field,cntfield,maxlimit) 
{

if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}

 function InsertText(con)
     {
            var txt=document.getElementById('ctl00_ContentPlaceHolder1_txtmessage');
            var br = ((txt.selectionStart == '0') ? "ff" : (document.selection ? "ie" : false ) );
            
            var CaretPos = 0;
            var mosPos = 0;
            var delimiter = "#";
           
            if (br=="ie")
            {
                txt.focus();
		        var range = document.selection.createRange();
		        if(con.options[con.selectedIndex].text == "--Select--")
		        {
		        range.text = range.text;
		        }
		        else
		        {
		        range.text = delimiter+con.options[con.selectedIndex].text+delimiter;
		        }
            }
            else if (br='ff')
            {            
                mosPos = txt.selectionStart;
                var strFirst = txt.value.substring(0, mosPos);
                var strLast =  txt.value.substring(mosPos);
                if(txt.value == "")
                {
                if(con.options[con.selectedIndex].text == "--Select--")
                {
                txt.value = strFirst + strLast;
                }
                else
                {
                    txt.value = delimiter+con.options[con.selectedIndex].text+delimiter; 
                    }
                }
                else
                {
                if(con.options[con.selectedIndex].text == "--Select--")
                {
                txt.value = strFirst + strLast;
                }
                else
                {
                txt.value = strFirst + delimiter+con.options[con.selectedIndex].text+delimiter + strLast;
                }
                }
            }
           
        }
        
        
    function InsertText1(con)
     {
            var txt=document.getElementById('ctl00_ContentPlaceHolder1_txtmessage');
            var br = ((txt.selectionStart == '0') ? "ff" : (document.selection ? "ie" : false ) );
            
            var CaretPos = 0;
            var mosPos = 0;
            var delimiter = "#";
           
            if (br=="ie")
            {
                txt.focus();
		        var range = document.selection.createRange();
		        if(con.options[con.selectedIndex].text == "--Select--")
		        {
		        range.text = range.text;
		        }
		        else
		        {
		        range.text = con.options[con.selectedIndex].value;
		        }
            }
            else if (br='ff')
            {            
                mosPos = txt.selectionStart;
                var strFirst = txt.value.substring(0, mosPos);
                var strLast =  txt.value.substring(mosPos);
                if(txt.value == "")
                {
                if(con.options[con.selectedIndex].text == "--Select--")
                {
                txt.value = strFirst + strLast;
                }
                else
                {
                    txt.value =con.options[con.selectedIndex].value; 
                    }
                }
                else
                {
                if(con.options[con.selectedIndex].text == "--Select--")
                {
                txt.value = strFirst + strLast;
                }
                else
                {
                txt.value = strFirst + con.options[con.selectedIndex].value + strLast;
                }
                }
            }
           
        }
        